package ystp.support;

import jxl.write.Label;
import jxl.write.WritableCellFormat;
import jxl.write.WritableSheet;
import jxl.write.WriteException;

import java.util.*;

public class TyConfig {
    // 设置循环
    /*
     * 1 品规
     * 2 品牌 品规
     * 3 品种品牌品规
     */
    public static int getXunhuan(String ppxiangmuleixing) {
        int i = 1;
        switch (ppxiangmuleixing) {
            case "202":
            case "203":
            case "207":
            case "204":
                i = 2;
                break;
            case "103":
            case "104":
            case "217":
            case "218":
            case "219":
            case "12":
                i = 3;
                break;

        }
        return i;
    }

    // 统计票数
    /*
     * 1 品规票数
     * 2 品牌票数
     */
    public static int getCount(String ppxiangmuleixing) {
        int i = 1;
        switch (ppxiangmuleixing) {
            case "103":
            case "104":
                i = 3;
                break;
        }
        return i;
    }

    // 设置品牌列
    public static String getPinpai(String ppxiangmuleixing) {
        String str = "";
        switch (ppxiangmuleixing) {
            case "202":
            case "203":
            case "204":
            case "205":
            case "207":
            case "7":
                str = "text1";
                break;
            case "100":
            case "12":
                str = "text2";
                break;
            case "103":
                str = "text5";
                break;
            case "104":
                str = "text12";
                break;
            case "217":
            case "218":
            case "219":
                str = "text19";
                break;
        }
        return str;
    }

    // 设置规则 一个品牌必须且仅能选择一个品规
    public static boolean hasRule_PinpaiOnlyPingui(String ppxiangmuleixing) {
        boolean result = false;
        switch (ppxiangmuleixing) {
            case "202":
            case "204":
            case "207":
                result = true;
                break;
        }
        return result;
    }
    // 设置规则 品规最大选择数量
    public static boolean hasRule_needPinguiMax(String ppxiangmuleixing) {
        boolean result = false;
        switch (ppxiangmuleixing) {
            case "212":
            case "219":
                result = true;
                break;
        }
        return result;
    }

    // 设置规则 特定品牌选几个
    public static PinpaiNeedPinguiNumResult Rule_PinpaiPinguiNum(String ppxiangmuleixing, String ppxuhao) {
        int num = 99;
        boolean require = false;
        switch (ppxiangmuleixing) {
            case "100":
                switch (ppxuhao) {
                    case "青霉素类":
                        require = true;
                        break;
                    case "碳青霉烯类":
                        num = 2;
                        require = true;
                        break;
                }
        }
        return new PinpaiNeedPinguiNumResult(num, require);
    }

    // 设置规则 指定品牌选几个品规
    public static boolean hasRule_PinpaiPinguiNum(String ppxiangmuleixing) {
        boolean result = false;
        switch (ppxiangmuleixing) {
            case "77":
                result = true;
                break;
        }
        return result;
    }
    public static PinpaiNeedPinguiNumResult Rule_PinzhongPinguiNum(String ppxiangmuleixing, String ppxuhao) {
        int num = 99;
        boolean require = false;
        switch (ppxiangmuleixing) {
            case "217":
            case "219":
                switch (ppxuhao) {
                    case "10":
                        num=10;
                        break;
                    case "4":
                        num=11;
                        break;
                    case "2":
                    case "7":
                        num=12;
                        break;
                    case "8":
                        num=13;
                        break;
                    case "9":
                        num=14;
                        break;
                    case "3":
                        num=16;
                        break;
                    case "6":
                        num=18;
                        break;
                    case "14":
                    case "15":
                    case "16":
                        num=2;
                        break;
                    case "13":
                        num=3;
                        break;
                    case "12":
                        num=4;
                        break;
                    case "5":
                        num=5;
                        break;
                    case "1":
                        num=6;
                        break;
                    case "11":
                        num=8;
                        break;
                }
        }
        return new PinpaiNeedPinguiNumResult(num, require);
    }
    public static PinpaiNeedPinguiNumResult Rule_PinzhongPinguiNumsp(String ppxiangmuleixing, String ppxuhao) {
        int num = 0;
        boolean require = false;
        switch (ppxiangmuleixing) {
            case "219":
                switch (ppxuhao) {
                    case "10":
                        num=10;
                        break;
                    case "4":
                        num=11;
                        break;
                    case "2":
                    case "7":
                        num=12;
                        break;
                    case "8":
                        num=13;
                        break;
                    case "9":
                        num=14;
                        break;
                    case "3":
                        num=16;
                        break;
                    case "6":
                        num=18;
                        break;
                    case "14":
                    case "15":
                    case "16":
                        num=2;
                        break;
                    case "13":
                        num=3;
                        break;
                    case "12":
                        num=4;
                        break;
                    case "5":
                        num=5;
                        break;
                    case "1":
                        num=6;
                        break;
                    case "11":
                        num=8;
                        break;
                }
        }
        return new PinpaiNeedPinguiNumResult(num, require);
    }

    // 设置规则 指定品zhong选几个品规
    public static boolean hasRule_PinzhongPinguiNum(String ppxiangmuleixing) {
        boolean result = false;
        switch (ppxiangmuleixing) {
            case "217":
            case "219":
                result = true;
                break;
        }
        return result;
    }
    // 设置规则 需要全选
    public static boolean hasRule_NeedAll(String ppxiangmuleixing) {
        boolean result = false;
        switch (ppxiangmuleixing) {
            case "205":
            case "203":
                result = true;
                break;
        }
        return result;
    }

    // 设置通过比例 >
    public static double getPassCount(String ppxiangmuleixing) {
        switch (ppxiangmuleixing) {
            case "208":
            case "209":
            case "210":
            case "211":
            case "212":
                return (double) 1 / (double) 2;
        }
        return (double) 2 / (double) 3;
    }

    // 设置规则 淘汰品规不可选择
    public static boolean hasRule_eliminated(String ppxiangmuleixing) {
        boolean result = false;
        switch (ppxiangmuleixing) {
            case "43":
                result = true;
                break;
        }
        return result;
    }

    // 设置品种列 没有留空
    public static String getPinzhong(String ppxiangmuleixing) {
        String str = "";
        switch (ppxiangmuleixing) {
            case "100":
            case "103":
            case "104":
                str = "text1";
                break;
            case "217":
            case "218":
            case "219":
                str = "text20";
                break;
        }
        return str;
    }

    // 投票类型 是否投品牌
    public static boolean IsVotePinpai(String ppxiangmuleixing) {
        boolean flag = false;
        switch (ppxiangmuleixing) {
            case "46":
                flag = true;
                break;
        }
        return flag;
    }

    // 投票类型 是否投品种
    public static boolean IsVotePinzhong(String ppxiangmuleixing) {
        boolean flag = false;
        switch (ppxiangmuleixing) {
            case "103":
            case "104":
                flag = true;
                break;
        }
        return flag;
    }

    // 是否2层表头
    public static boolean IsTwoTitle(String ppxiangmuleixing) {
        boolean flag = false;
        switch (ppxiangmuleixing) {
            case "202":
                flag = true;
                break;
            case "104":
                flag = true;
                break;
        }
        return flag;
    }

    // 设置导入截止列（内容不包括投票结果）
    // exel-文件-选择-常规与保存-勾选R1C1引用样式
    public static int getExel(String ppxiangmuleixing) {
        int i = 0;
        switch (ppxiangmuleixing) {
            case "203":
                i = 7;
                break;
            case "201":
                i = 15;
                break;
            case "202":
                i = 19;
                break;
            case "204":
                i = 13;
                break;
            case "205":
                i = 13;
                break;
            case "206":
                i = 14;
                break;
            case "207":
                i = 13;
                break;
            case "208":
                i = 11;
                break;
            case "100":
                i = 14;
                break;
            case "217":
            case "218":
            case "219":
                i = 20;
                break;
            case "12":
                i = 20;
                break;
            case "7":
                i = 20;
                break;
            case "8":
                i = 15;
                break;
            case "9":
                i = 22;
                break;
            case "10":
                i = 19;
                break;
            case "103":
                i = 16;
                break;
            case "104":
                i = 23;
                break;
            case "101":
                i = 9;
                break;
            case "102":
                i = 7;
                break;
            case "209":
                i = 11;
                break;
            case "210":
                i = 13;
                break;
            case "211":
                i = 12;
                break;
            case "212":
                i = 10;
                break;
            case "213":
                i = 18;
                break;
            case "214":
                i = 13;
                break;
            case "215":
                i = 13;
                break;
            case "216":
                i = 14;
                break;
        }
        return i;
    }

    // 设置签字表截止列（不包括投票结果列）
    public static int getQianzibiaoEnd(String ppxiangmuleixing) {
        int i = 0;
        switch (ppxiangmuleixing) {
            case "203":
                i = 7;
                break;
            case "201":
                i = 15;
                break;
            case "202":
                i = 19;
                break;
            case "204":
                i = 13;
                break;
            case "205":
                i = 13;
                break;
            case "206":
                i = 14;
                break;
            case "207":
                i = 13;
                break;
            case "208":
                i = 11;
                break;
            case "100":
                i = 14;
                break;
            case "217":
            case "218":
            case "219":
                i = 16;
                break;
            case "12":
                i = 20;
                break;
            case "7":
                i = 20;
                break;
            case "8":
                i = 15;
                break;
            case "9":
                i = 22;
                break;
            case "10":
                i = 19;
                break;
            case "103":
                i = 16;
                break;
            case "104":
                i = 23;
                break;
            case "101":
                i = 9;
                break;
            case "102":
                i = 7;
                break;
            case "209":
                i = 11;
                break;
            case "210":
                i = 13;
                break;
            case "211":
                i = 12;
                break;
            case "212":
                i = 10;
                break;
            case "213":
                i = 18;
                break;
            case "214":
                i = 13;
                break;
            case "215":
                i = 13;
                break;
            case "216":
                i = 14;
                break;
        }
        return i;
    }

    // 设置导出列宽度（只包含内容列）
    public static int[] getColumnView(String ppxiangmuleixing) {
        int[] result;
        switch (ppxiangmuleixing) {
            case "203":
                result =  new int[] { 7, 20, 19, 16, 24, 14,14 };
            case "201":
                result = new int[] { 6, 19, 11, 10, 17, 10, 9, 9, 9, 8, 9, 20, 20, 9,9 };
                break;
            case "7":
                result = new int[] { 6, 20, 20, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 15, 15, 15, 15, 15, 15, 10 };
                break;
            case "8":
                result = new int[] { 6, 20, 20, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 15, 15 };
                break;
            case "9":
                result = new int[] { 6, 20, 20, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 15, 15, 15, 15, 15, 15 };
                break;
            case "10":
                result = new int[] { 6, 20, 20, 10, 10, 10, 10, 10, 10, 10, 10, 20, 20, 20, 20, 20, 20, 20, 10 };
                break;
            case "101":
                result = new int[] { 6, 12, 26, 15, 15, 15, 15, 15, 15 };
                break;
            case "209":
                result = new int[] { 6, 26, 15, 15, 15,   15, 15, 15, 15, 15,   15 };
                break;
            case "210":
                result = new int[] { 6, 26, 15, 15, 15,   15, 15, 15, 15, 15,   15, 15, 15 };
                break;
            case "211":
                result = new int[] { 6, 26, 15, 20, 20,   15, 15, 15, 15, 15,   15, 15 };
                break;
            case "212":
                result = new int[] { 6, 26, 15, 15, 15,   15, 15, 15, 15, 15 };
                break;
            case "213":
                result = new int[] { 6, 26, 20, 10, 10,   10, 20, 20, 26, 20,   20, 20, 20, 20, 20,   15, 15, 15};
                break;
            case "214":
                result = new int[] { 6, 20, 15, 15, 15,   15, 20, 20, 20, 20,   20, 15, 15 };
                break;
            case "215":
                result = new int[] { 6, 26, 20, 15, 15,   20, 25, 20, 20, 20,   20, 15, 20  };
                break;
            case "216":
                result = new int[] { 6, 26, 20, 15, 15,   20, 20, 20, 26, 20,   15, 15, 15,15 };
                break;

            default:
                result = new int[27]; // Assuming exelend is accessible here
                Arrays.fill(result, 15); // Default width
                break;
        }
        return result;
    }

    // 设置签字表开始行
    public static int getQianzibiaoStartRow(String ppxiangmuleixing) {
        int i = 3;
        switch (ppxiangmuleixing) {
            case "202":
            case "104":
                i = 4;
                break;

        }
        return i;
    }

    public static boolean isPinpaiLie(String ppxiangmuleixing, int tar) {
        Set<Integer> numbersSet = new HashSet<>();
        ;

        switch (ppxiangmuleixing) {
            case "202":
            case "203":
            case "204":
            case "207":
                numbersSet.add(1);
                break;
            /*
             * case "11":
             * Arrays.asList(1, 2).forEach(numbersSet::add);
             * break;
             */
            case "100":
                break;
            case "103":
                numbersSet.add(5);
                break;
            case "104":
                numbersSet.add(12);
                break;
            default:
                // 可选的默认处理
                break;
        }
        return numbersSet.contains(tar);

    }

    public static boolean isPinzhongLie(String ppxiangmuleixing, int tar) {
        Set<Integer> numbersSet = new HashSet<>();
        switch (ppxiangmuleixing) {
            case "100":
                numbersSet.add(1);
                break;
            case "217":
            case "218":
            case "219":
                numbersSet.add(2);
                break;
            case "103":
                numbersSet.add(1);
                numbersSet.add(2);
                numbersSet.add(3);
                numbersSet.add(4);
                numbersSet.add(16);
                break;
            case "104":
                Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10,11,22,23).forEach(numbersSet::add);
                break;
            default:
                // 可选的默认处理
                break;
        }
        return numbersSet.contains(tar);

    }

    // public static int[] getQianzibiao3(String ppxiangmuleixing){
    // int[] a = new int[0];
    // switch (ppxiangmuleixing){
    // case "40":a= new int[]{2,3,4,5,6,7,8,9,10,11,12};break;
    //
    // }
    // return a;
    // }
    // 设置exel表头
    public static Map<Integer, String> getExelTitle(String ppxiangmuleixing) {
        Map<Integer, String> map = new HashMap<>();
        switch (ppxiangmuleixing) {
            case "203": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "规格");
                map.put(4, "单位");
                map.put(5, "价格（元）");
                map.put(6, "一致性评价");
                map.put(7, "生产企业");
            }
                break;
            case "201": {
                map.put(1, "序号");
                map.put(2, "药品分类");
                map.put(3, "药品类别");
                map.put(4, "药品名称");
                map.put(5, "规格");
                map.put(6, "单位");
                map.put(7, "医保类别");
                map.put(8, "通过一致性评价");
                map.put(9, "价格（元）");
                map.put(10, "平台药品来源");
                map.put(11, "基药");
                map.put(12, "生产企业");
                map.put(13, "提报科室");
                map.put(14, "临床是否有需求");
                map.put(15, "抗肿瘤药物管理工作小组会意见");
            }
                break;
            case "204": {
                map.put(1, "序号");
                map.put(2, "产品编码");
                map.put(3, "药品名称");
                map.put(4, "剂型");
                map.put(5, "规格");
                map.put(6, "转换比");
                map.put(7, "包装单位");
                map.put(8, "生产企业");
                map.put(9, "基药");
                map.put(10, "医保");
                map.put(11, "一致性评价");
                map.put(12, "价格");
                map.put(13, "备注");
            }
                break;
            case "205": {
                map.put(1, "序号");
                map.put(2, "药品分类");
                map.put(3, "药品类别");
                map.put(4, "药品名称");
                map.put(5, "规格");
                map.put(6, "单位");
                map.put(7, "医保类别");
                map.put(8, "通过一致性评价");
                map.put(9, "价格（元）");
                map.put(10, "平台药品来源");
                map.put(11, "基药");
                map.put(12, "生产企业");
                map.put(13, "备注");
            }
                break;
            case "206": {
                map.put(1, "序号");
                map.put(2, "产品编码");
                map.put(3, "药品名称");
                map.put(4, "剂型");
                map.put(5, "规格");
                map.put(6, "转换比");
                map.put(7, "包装单位");
                map.put(8, "生产企业");
                map.put(9, "基药");
                map.put(10, "医保");
                map.put(11, "一致性评价");
                map.put(12, "价格（元）");
                map.put(13, "申请科室");
                map.put(14, "备注");
            }
            break;
            case "207": {
                map.put(1, "序号");
                map.put(2, "产品编码");
                map.put(3, "药品名称");
                map.put(4, "剂型");
                map.put(5, "规格");
                map.put(6, "转换比");
                map.put(7, "包装单位");
                map.put(8, "生产企业");
                map.put(9, "基药");
                map.put(10, "医保");
                map.put(11, "一致性评价");
                map.put(12, "价格");
                map.put(13, "备注");
            }
                break;
            case "208": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "分类");
                map.put(4, "规格");
                map.put(5, "厂家");
                map.put(6, "价格（元）");
                map.put(7, "单位");
                map.put(8, "基药");
                map.put(9, "集采");
                map.put(10, "备注");
                map.put(11, "小组会投票结果");
            }
            break;
            case "100": {
                map.put(1, "品种序号");
                map.put(2, "序号");
                map.put(3, "产品编码");
                map.put(4, "药品名称");
                map.put(5, "剂型");
                map.put(6, "规格");
                map.put(7, "转换比");
                map.put(8, "包装单位");
                map.put(9, "生产企业");
                map.put(10, "基药");
                map.put(11, "医保");
                map.put(12, "一致性评价");
                map.put(13, "价格");
                map.put(14, "备注");
            }
                break;
            case "217":
            case "218":
            case "219":
            {
                map.put(1, "序号");
                map.put(2, "医保一级分类");
                map.put(3, "药品名称");
                map.put(4, "单疗程治疗费用");
                map.put(5, "日均治疗费用（元）");
                map.put(6, "基药");
                map.put(7, "集采");
                map.put(8, "医保类别");
                map.put(9, "西医适应症");
                map.put(10, "功效相近院内制剂");
                map.put(11, "23年使用金额（万元）");
                map.put(12, "24年使用金额（万元）");
                map.put(13, "25年1-5月使用金额（万元）");
                map.put(14, "规格");
                map.put(15, "价格（元）");
                map.put(16, "国谈");
            }
                break;
            case "12": {
                map.put(1, "类型");
                map.put(2, "序号");
                map.put(3, "药品编码");
                map.put(4, "药品名称");
                map.put(5, "日均治疗费用（元）");
                map.put(6, "单价");
                map.put(7, "日均用量");
                map.put(8, "单位");
                map.put(9, "医保类别");
                map.put(10, "基药");
                map.put(11, "集采");
                map.put(12, "医保一级分类");
                map.put(13, "医保二级分类");
                map.put(14, "西医适应症");
                map.put(15, "功效相近院内制剂");
                map.put(16, "23年使用金额（万元）");
                map.put(17, "24年使用金额（万元）");
                map.put(18, "25年1-5月使用金额（万元）");
                map.put(19, "规格");
                map.put(20, "价格（元）");
            }
                break;
            case "7": {
                map.put(1, "序号");
                map.put(2, "药品编码");
                map.put(3, "药品名称");
                map.put(4, "日均治疗费用（元）");
                map.put(5, "单价");
                map.put(6, "日均用量");
                map.put(7, "单位");
                map.put(8, "医保类别");
                map.put(9, "基药");
                map.put(10, "集采");
                map.put(11, "医保一级分类");
                map.put(12, "医保二级分类");
                map.put(13, "西医适应症");
                map.put(14, "同类口服剂型");
                map.put(15, "23年使用金额（万元）");
                map.put(16, "24年使用金额（万元）");
                map.put(17, "25年1-5月使用金额（万元）");
                map.put(18, "规格");
                map.put(19, "价格（元）");
                map.put(20, "国谈");
            }
                break;
            case "8": {
                map.put(1, "序号");
                map.put(2, "药品编码");
                map.put(3, "药品名称");
                map.put(4, "日治疗费用（元）");
                map.put(5, "单价");
                map.put(6, "医保类别");
                map.put(7, "基药");
                map.put(8, "集采");
                map.put(9, "医保一级分类");
                map.put(10, "医保二级分类");
                map.put(11, "医保三级分类");
                map.put(12, "医保四级分类");
                map.put(13, "西医适应症");
                map.put(14, "规格");
                map.put(15, "价格（元）");
            }
                break;
            case "9": {
                map.put(1, "序号");
                map.put(2, "药品编码");
                map.put(3, "药品名称");
                map.put(4, "日均治疗费用（元）");
                map.put(5, "单价");
                map.put(6, "日均用量");
                map.put(7, "剂型");
                map.put(8, "单位");
                map.put(9, "医保类别");
                map.put(10, "基药");
                map.put(11, "集采");
                map.put(12, "医保一级分类");
                map.put(13, "医保二级分类");
                map.put(14, "医保三级分类");
                map.put(15, "医保四级分类");
                map.put(16, "西医适应症");
                map.put(17, "功效相近院内制剂");
                map.put(18, "23年使用金额（万元）");
                map.put(19, "24年使用金额（万元）");
                map.put(20, "25年1-5月使用金额（万元）");
                map.put(21, "规格");
                map.put(22, "价格（元）");
            }
                break;
            case "10": {
                map.put(1, "序号");
                map.put(2, "药品编码");
                map.put(3, "药品名称");
                map.put(4, "日均治疗费用（元）");
                map.put(5, "单价");
                map.put(6, "日均用量");
                map.put(7, "剂型");
                map.put(8, "单位");
                map.put(9, "医保类别");
                map.put(10, "基药");
                map.put(11, "集采");
                map.put(12, "医保一级分类");
                map.put(13, "医保二级分类");
                map.put(14, "西医适应症");
                map.put(15, "23年使用金额（万元）");
                map.put(16, "24年使用金额（万元）");
                map.put(17, "25年1-5月使用金额（万元）");
                map.put(18, "规格");
                map.put(19, "价格（元）");
            }
                break;
            case "103": {
                map.put(1, "序号");
                map.put(2, "类别");
                map.put(3, "品种名");
                map.put(4, "技术要求");
                map.put(5, "参考品牌");
                map.put(6, "平台编码");
                map.put(7, "产品名称");
                map.put(8, "规格");
                map.put(9, "型号");
                map.put(10, "注册证号");
                map.put(11, "生产厂家");
                map.put(12, "单位");
                map.put(13, "单价");
                map.put(14, "医保编码");
                map.put(15, "备注");
                map.put(16, "论证会结果");
            }
                break;
            case "101": {
                map.put(1, "序号");
                map.put(2, "报废批次");
                map.put(3, "唯一识别码");
                map.put(4, "申请科室");
                map.put(5, "设备名称");
                map.put(6, "品牌型号");
                map.put(7, "数量");
                map.put(8, "单价（元）");
                map.put(9, "启用日期");
            }
                break;
            case "102": {
                map.put(1, "序号");
                map.put(2, "项目名称");
                map.put(3, "申请科室");
                map.put(4, "设备名称");
                map.put(5, "数量");
                map.put(6, "预算单价（万元）");
                map.put(7, "预算总价（万元）");
            }
            break;

            case "209": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "分类");
                map.put(4, "规格");
                map.put(5, "厂家");
                map.put(6, "价格（元）");
                map.put(7, "单位");
                map.put(8, "基药");
                map.put(9, "集采");
                map.put(10, "备注");
                map.put(11, "小组会投票结果");
            }
            break;
            case "210": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "分类");
                map.put(4, "规格");
                map.put(5, "厂家");
                map.put(6, "价格（元）");
                map.put(7, "单位");
                map.put(8, "医保类别");
                map.put(9, "基药");
                map.put(10, "集采");
                map.put(11, "创新");
                map.put(12, "备注");
                map.put(13, "小组会投票结果");
            }
            break;
            case "211": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "分类");
                map.put(4, "规格");
                map.put(5, "厂家");
                map.put(6, "价格（元）");
                map.put(7, "单位");
                map.put(8, "医保类别");
                map.put(9, "基药");
                map.put(10, "集采");
                map.put(11, "备注");
                map.put(12, "小组会投票结果");
            }
            break;
            case "212": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "规格");
                map.put(4, "厂家");
                map.put(5, "价格（元）");
                map.put(6, "单位");
                map.put(7, "医保类别");
                map.put(8, "基药");
                map.put(9, "集采");
                map.put(10, "备注");
            }
            break;
            case "213": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "日均治疗费用（元）");
                map.put(4, "医保类别");
                map.put(5, "基药");
                map.put(6, "集采");
                map.put(7, "医保一级分类");
                map.put(8, "医保二级分类");
                map.put(9, "医保三级分类");
                map.put(10, "西医适应症");
                map.put(11, "医保四级分类");
                map.put(12, "同类口服剂型");
                map.put(13, "23年使用金额（万元）");
                map.put(14, "24年使用金额（万元）");
                map.put(15, "25年1-5月使用金额（万元）");
                map.put(16, "规格");
                map.put(17, "价格（元）");
                map.put(18, "国谈");
            }
            break;
            case "214": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "日均治疗费用（元）");
                map.put(4, "医保类别");
                map.put(5, "基药");
                map.put(6, "集采");
                map.put(7, "医保一级分类");
                map.put(8, "医保二级分类");
                map.put(9, "医保三级分类");
                map.put(10, "医保四级分类");
                map.put(11, "西医适应症");
                map.put(12, "规格");
                map.put(13, "价格");
            }
            break;
            case "215": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "日均治疗费用（元）");
                map.put(4, "基药");
                map.put(5, "集采");
                map.put(6, "医保二级分类");
                map.put(7, "西医适应症");
                map.put(8, "23年使用金额（万元）");
                map.put(9, "24年使用金额（万元）");
                map.put(10, "25年1-5月使用金额（万元）");
                map.put(11, "规格");
                map.put(12, "价格（元）");
                map.put(13, "临床是否需要");
            }
            break;
            case "216": {
                map.put(1, "序号");
                map.put(2, "药品名称");
                map.put(3, "日均治疗费用（元）");
                map.put(4, "医保类别");
                map.put(5, "基药");
                map.put(6, "集采");
                map.put(7, "医保一级分类");
                map.put(8, "医保二级分类");
                map.put(9, "西医适应症");
                map.put(10, "23年使用金额（万元）");
                map.put(11, "24年使用金额（万元）");
                map.put(12, "25年1-5月使用金额（万元）");
                map.put(13, "规格");
                map.put(14, "价格（元）");
            }
            break;
        }
        return map;
    }

    //
    public static void setTwoTitle(WritableSheet wsheet, WritableCellFormat wcfFC, String ppxiangmuleixing, int k)
            throws WriteException {
        if ("202".equals(ppxiangmuleixing)) {
            // 添加合并单元格的标题
            addMergedTitle(wsheet, 0, 2, 0, 3, "序号", wcfFC);
            addMergedTitle(wsheet, 1, 2, 9, 2, "调整后目录品种", wcfFC);
            addMergedTitle(wsheet, 10, 2, 18, 2, "原有目录品种", wcfFC);
            if (k == 2) {
                addMergedTitle(wsheet, 19, 2, 19, 3, "委员表决票数", wcfFC);
                addMergedTitle(wsheet, 20, 2, 20, 3, "表决结果", wcfFC);
            }
            if (k == 1) {
                addMergedTitle(wsheet, 19, 2, 19, 3, "表决意见", wcfFC);
            }

            // 添加子标题
            String[] subTitles1 = { "产品编码", "药品名称", "规格", "单位", "剂型", "生产企业", "价格(元)", "备注","抗肿瘤药物管理工作小组会意见" };
            for (int i = 0; i < subTitles1.length; i++) {
                wsheet.addCell(new Label(1 + i, 3, subTitles1[i], wcfFC));
            }

            String[] subTitles2 = { "产品编码", "药品名称", "规格", "单位", "剂型", "生产企业", "价格(元)", "备注" ,"抗肿瘤药物管理工作小组会意见"};
            for (int i = 0; i < subTitles2.length; i++) {
                wsheet.addCell(new Label(10 + i, 3, subTitles2[i], wcfFC));
            }

        }
        if ("104".equals(ppxiangmuleixing)) {

            // 添加合并单元格的标题
            addMergedTitle(wsheet, 0, 2, 0, 3, "序号", wcfFC);
            addMergedTitle(wsheet, 1, 2, 1, 3, "类别", wcfFC);
            addMergedTitle(wsheet, 2, 2, 2, 3, "品种名", wcfFC);
            addMergedTitle(wsheet, 3, 2, 3, 3, "替换理由（简要说明）", wcfFC);
            addMergedTitle(wsheet, 4, 2, 4, 3, "技术参数", wcfFC);
            addMergedTitle(wsheet, 5, 2, 10, 2, "被替换产品信息", wcfFC);
            addMergedTitle(wsheet, 11, 2, 20, 2, "替换产品信息", wcfFC);
            addMergedTitle(wsheet, 21, 2, 21, 3, "备注", wcfFC);
         /*   addMergedTitle(wsheet, 22, 2, 22, 3, "提报科室", wcfFC);*/
            addMergedTitle(wsheet, 22, 2, 22, 3, "论证会结果", wcfFC);
            if (k == 2) {
                addMergedTitle(wsheet, 23, 2, 23, 3, "委员表决票数", wcfFC);
                addMergedTitle(wsheet, 24, 2, 24, 3, "表决结果", wcfFC);
            }
            if (k == 1) {
                addMergedTitle(wsheet, 23, 2, 23, 3, "表决意见", wcfFC);
            }

            // 添加子标题 - 被替换产品信息
            String[] subTitles1 = { "物资编码", "产品名称", "规格", "型号", "生产厂家", "单价" };
            for (int i = 0; i < subTitles1.length; i++) {
                wsheet.addCell(new Label(5 + i, 3, subTitles1[i], wcfFC));
            }

            // 添加子标题 - 替换产品信息
            String[] subTitles2 = { "参考品牌", "平台编码", "产品名称", "规格", "型号", "注册证号", "生产厂家", "单位", "单价", "医保编码" };
            for (int i = 0; i < subTitles2.length; i++) {
                wsheet.addCell(new Label(11 + i, 3, subTitles2[i], wcfFC));
            }

        }

    }

    // 设置导出行高
    public static int getRowHeight() {
        return 360;
    }

    // 设置导出是否固定行高
    public static boolean SetRowHeight() {
        return false;
    }

    // 设置导入开始行
    public static int getExelStartLine(String ppxiangmuleixing) {
        int i = 2;
        switch (ppxiangmuleixing) {
            case "202":
            case "81":
            case "104":
            case "209":
            case "210":
            case "211":
            case "212":
            case "213":
            case "214":
            case "215":
            case "216":
                i = 3;
                break;
        }
        return i;
    }

    // 设置导入的哪一列来判断是否投票（全投不用管）
    public static int setIsVote(String ppxiangmuleixing) {
        int i = 0;
        switch (ppxiangmuleixing) {
            case "40":
                i = 13;
                break;
        }
        return i - 1;
    }

    public static class PinpaiNeedPinguiNumResult {
        private int num;
        private boolean require;

        public PinpaiNeedPinguiNumResult(int num, boolean require) {
            this.num = num;
            this.require = require;
        }

        // Getter 方法
        public int getNum() {
            return num;
        }

        public boolean getRequire() {
            return require;
        }
    }

    private static void addMergedTitle(WritableSheet sheet, int col1, int row1, int col2, int row2,
            String title, WritableCellFormat format) throws WriteException {
        sheet.addCell(new Label(col1, row1, title, format));
        sheet.mergeCells(col1, row1, col2, row2);
    }
}
